home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 03 - 1987 / 03.11 Nov 87 / C string library / PStrLib Source / PStr2Num.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-21  |  552 b   |  18 lines  |  [TEXT/KAHL]

  1. /*    FILE:    PStr2Num.c
  2.     Sets value of a given type of number based on a pascal string 
  3.     representation, returning TRUE if it fails to do so. */
  4. #include    "PStrLib.h"
  5.  
  6. PStr2Num(pStr, type, numPtr)
  7. char    *pStr;        /* points to a PASCAL string */        
  8. int        type;        /* type of variable n points at */
  9. void    *numPtr;    /* generic pointer */
  10. {
  11.     auto        Decimal        _decimal_;
  12.     auto        int            valid, index = 1; /* start-scan pos. of pStr */
  13.     
  14.     Str2Dec(pStr, &index, &_decimal_, &valid);
  15.     fp68k(&_decimal_, numPtr, type + FOD2B);
  16.     return(!valid);        /*    returns TRUE if failed */            
  17. }
  18.